<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
﻿<!DOCTYPE HTML>
<html>
<head>
<jsp:include page="common_header.jsp"></jsp:include>
<title>JBase v0.1</title>
</head>
<body>
<header class="navbar-wrapper">
	<div class="navbar navbar-fixed-top">
		<div class="container-fluid cl"> <a class="logo navbar-logo f-l mr-10 hidden-xs" href="#">JBase</a>  
			<span class="logo navbar-slogan f-l mr-10 hidden-xs">v0.1</span> 
			<a aria-hidden="false" class="nav-toggle Hui-iconfont visible-xs" href="javascript:;">&#xe667;</a>
			<nav class="nav navbar-nav">
				<ul class="cl">
					<li class="dropDown dropDown_hover"><a href="javascript:;" class="dropDown_A"><i class="Hui-iconfont">&#xe600;</i> 新增 <i class="Hui-iconfont">&#xe6d5;</i></a>
						<ul class="dropDown-menu menu radius box-shadow">
							<li><a href="javascript:;" onclick="article_add('添加资讯','article-add.html')"><i class="Hui-iconfont">&#xe616;</i> 资讯</a></li>
							<li><a href="javascript:;" onclick="picture_add('添加资讯','picture-add.html')"><i class="Hui-iconfont">&#xe613;</i> 图片</a></li>
							<li><a href="javascript:;" onclick="product_add('添加资讯','product-add.html')"><i class="Hui-iconfont">&#xe620;</i> 产品</a></li>
							<li><a href="javascript:;" onclick="member_add('添加用户','member-add.html','','510')"><i class="Hui-iconfont">&#xe60d;</i> 用户</a></li>
					</ul>
				</li>
			</ul>
		</nav>
		<nav id="Hui-userbar" class="nav navbar-nav navbar-userbar hidden-xs">
			<ul class="cl">
				<li class="dropDown dropDown_hover">
					<a href="#" class="dropDown_A"><span id="loginUserInfo"></span> <i class="Hui-iconfont">&#xe6d5;</i></a>
					<ul class="dropDown-menu menu radius box-shadow">
						<li><a href="javascript:;" onClick="myselfinfo()">个人信息</a></li>
						<li><a href="javascript:;" onClick="changePwd()">修改密码</a></li>
						<li><a href="#" onclick="logout()">切换账户</a></li>
						<li><a href="#" onclick="logout()" >退出</a></li>
				</ul>
			</li>
				<li id="Hui-msg"> <a href="#" title="消息"><span class="badge badge-danger">1</span><i class="Hui-iconfont" style="font-size:18px">&#xe68a;</i></a> </li>
				<li id="Hui-skin" class="dropDown right dropDown_hover"> <a href="javascript:;" class="dropDown_A" title="换肤"><i class="Hui-iconfont" style="font-size:18px">&#xe62a;</i></a>
					<ul class="dropDown-menu menu radius box-shadow">
						<li><a href="javascript:;" data-val="default" title="默认（黑色）">默认（黑色）</a></li>
						<li><a href="javascript:;" data-val="blue" title="蓝色">蓝色</a></li>
						<li><a href="javascript:;" data-val="green" title="绿色">绿色</a></li>
						<li><a href="javascript:;" data-val="red" title="红色">红色</a></li>
						<li><a href="javascript:;" data-val="yellow" title="黄色">黄色</a></li>
						<li><a href="javascript:;" data-val="orange" title="橙色">橙色</a></li>
					</ul>
				</li>
			</ul>
		</nav>
	</div>
</div>
</header>
<aside class="Hui-aside">
	<div class="menu_dropdown bk_2" id="menuDiv">
<!-- 		<dl id="menu-article"> -->
<!-- 			<dt><i class="Hui-iconfont">&#xe616;</i> 资讯管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt> -->
<!-- 			<dd> -->
<!-- 				<ul> -->
<!-- 					<li><a data-href="article-list.html" data-title="资讯管理" href="javascript:void(0)">资讯管理</a></li> -->
<!-- 			</ul> -->
<!-- 		</dd> -->
<!-- 	</dl> -->
<!-- 		<dl id="menu-product"> -->
<!-- 			<dt><i class="Hui-iconfont">&#xe620;</i> 产品管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt> -->
<!-- 			<dd> -->
<!-- 				<ul> -->
<!-- 					<li><a data-href="product-brand.html" data-title="品牌管理" href="javascript:void(0)">品牌管理</a></li> -->
<!-- 					<li><a data-href="product-category.html" data-title="分类管理" href="javascript:void(0)">分类管理</a></li> -->
<%-- 					<li><a data-href="${path}/user/toPage.do?page=product-list" data-title="产品管理" href="javascript:void(0)">产品管理</a></li> --%>
<!-- 			</ul> -->
<!-- 		</dd> -->
<!-- 	</dl> -->
<!-- 		<dl id="menu-admin"> -->
<!-- 			<dt><i class="Hui-iconfont">&#xe62d;</i> 用户管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt> -->
<!-- 			<dd> -->
<!-- 				<ul> -->
<%-- 					<li><a data-href="${path}/user/toPage.do?page=admin-role" data-title="角色管理" href="javascript:void(0)">角色管理</a></li> --%>
<%-- 					<li><a data-href="${path}/user/toPage.do?page=admin-permission" data-title="权限管理" href="javascript:void(0)">权限管理</a></li> --%>
<%-- 					<li><a data-href="${path}/user/toPage.do?page=admin-list" data-title="用户列表" href="javascript:void(0)">用户列表</a></li> --%>
<!-- 			</ul> -->
<!-- 		</dd> -->
<!-- 	</dl> -->
<!-- 		<dl id="menu-tongji"> -->
<!-- 			<dt><i class="Hui-iconfont">&#xe61a;</i> 报表统计<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt> -->
<!-- 			<dd> -->
<!-- 				<ul> -->
<!-- 					<li><a data-href="charts-1.html" data-title="折线图" href="javascript:void(0)">折线图</a></li> -->
<!-- 					<li><a data-href="charts-2.html" data-title="时间轴折线图" href="javascript:void(0)">时间轴折线图</a></li> -->
<!-- 					<li><a data-href="charts-3.html" data-title="区域图" href="javascript:void(0)">区域图</a></li> -->
<!-- 					<li><a data-href="charts-4.html" data-title="柱状图" href="javascript:void(0)">柱状图</a></li> -->
<!-- 					<li><a data-href="charts-5.html" data-title="饼状图" href="javascript:void(0)">饼状图</a></li> -->
<!-- 					<li><a data-href="charts-6.html" data-title="3D柱状图" href="javascript:void(0)">3D柱状图</a></li> -->
<!-- 					<li><a data-href="charts-7.html" data-title="3D饼状图" href="javascript:void(0)">3D饼状图</a></li> -->
<!-- 			</ul> -->
<!-- 		</dd> -->
<!-- 	</dl> -->
<!-- 		<dl id="menu-system"> -->
<!-- 			<dt><i class="Hui-iconfont">&#xe62e;</i> 系统管理<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt> -->
<!-- 			<dd> -->
<!-- 				<ul> -->
<!-- 					<li><a data-href="system-base.html" data-title="系统设置" href="javascript:void(0)">系统设置</a></li> -->
<!-- 					<li><a data-href="system-category.html" data-title="栏目管理" href="javascript:void(0)">栏目管理</a></li> -->
<%-- 					<li><a data-href="${path}/user/toPage.do?page=system-data" data-title="数据字典" href="javascript:void(0)">数据字典</a></li> --%>
<!-- 					<li><a data-href="system-shielding.html" data-title="屏蔽词" href="javascript:void(0)">屏蔽词</a></li> -->
<!-- 					<li><a data-href="system-log.html" data-title="系统日志" href="javascript:void(0)">系统日志</a></li> -->
<!-- 			</ul> -->
<!-- 		</dd> -->
<!-- 	</dl> -->
</div>
</aside>
<div class="dislpayArrow hidden-xs"><a class="pngfix" href="javascript:void(0);" onClick="displaynavbar(this)"></a></div>
<section class="Hui-article-box">
	<div id="Hui-tabNav" class="Hui-tabNav hidden-xs">
		<div class="Hui-tabNav-wp">
			<ul id="min_title_list" class="acrossTab cl">
				<li class="active">
					<span title="我的桌面" data-href="${path }/user/toPage.do?page=welcome">我的桌面</span>
					<em></em></li>
		</ul>
	</div>
		<div class="Hui-tabNav-more btn-group"><a id="js-tabNav-prev" class="btn radius btn-default size-S" href="javascript:;"><i class="Hui-iconfont">&#xe6d4;</i></a><a id="js-tabNav-next" class="btn radius btn-default size-S" href="javascript:;"><i class="Hui-iconfont">&#xe6d7;</i></a></div>
</div>
	<div id="iframe_box" class="Hui-article">
		<div class="show_iframe">
			<div style="display:none" class="loading"></div>
			<iframe scrolling="yes" frameborder="0" src="${path }/user/toPage.do?page=welcome"></iframe>
	</div>
</div>
</section>

<div class="contextMenu" id="Huiadminmenu">
	<ul>
		<li id="closethis">关闭当前 </li>
		<li id="closeall">关闭全部 </li>
</ul>
</div>
<jsp:include page="_footer.jsp"></jsp:include>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="${path }/lib/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript" src="${path }/static/js/utils.js?Math.random()"></script> 
<script type="text/javascript">
$(function(){
	/*$("#min_title_list li").contextMenu('Huiadminmenu', {
		bindings: {
			'closethis': function(t) {
				console.log(t);
				if(t.find("i")){
					t.find("i").trigger("click");
				}		
			},
			'closeall': function(t) {
				alert('Trigger was '+t.id+'\nAction was Email');
			},
		}
	});*/
	
	jajax({
		url:'${path}/user/loginUserInfo.do',
		success:function(data){
			$('#loginUserInfo').text('你好,'+data.data);
		}
	});
	
	$.ajax({
        type: 'get',
        url: '../user/queryMenus.do',
        cache: false,  //禁用缓存
        dataType: "json",
        success: function (result) {
        	if (result.code == 0) {
        		
        		var $menuDiv = $('#menuDiv');
        		
        		for(let m of result.data){
        			
        			let menuLi = [];
        			for(let secm of m.children){
        				menuLi.push(strTempl('<li><a data-href="${path}/user/toPage.do?page={1}" data-title="{0}" href="javascript:void(0)">{0}</a></li>', secm.name, secm.url));
        			}
        			
	        		$menuDiv.append(strTempl('<dl id="menu-system"><dt><i class="Hui-iconfont">&#xe62e;</i> {0}<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i></dt><dd> <ul> {1} </ul> </dd>   </dl> ',
	        				m.name, menuLi.join(' ')));
        		}
        		
        		$(".Hui-aside").Huifold({
        			titCell:'.menu_dropdown dl dt',
        			mainCell:'.menu_dropdown dl dd',
        		});
        		
			} else{
				alert('error');
			}
        }
    });
	
});
/*个人信息*/
function myselfinfo(){
	layer.open({
		type: 2,
		area: [600+'px', 400 +'px'],
		fix: false, //不固定
		maxmin: true,
		shade:0.4,
		title: '用户信息',
		content: '${path}/user/toPage.do?page=user-show',
		success: function(layero, index){
		    var body = layer.getChildFrame('body', index);
		    var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
		    iframeWin.fillData();
// 		    console.log(body.html()) //得到iframe页的body内容
// 		    body.find('input').val('Hi，我是从父页来的')
	    }
	});
}

/*资讯-添加*/
function article_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*图片-添加*/
function picture_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*产品-添加*/
function product_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*用户-添加*/
function member_add(title,url,w,h){
	layer_show(title,url,w,h);
}

function logout(){
	$.ajax({
		url: "${path}/user/logout.do",
		type: "get",
		success: function(data, textStatus){
			if (data.code == 0) {
				window.location.href = '${path}/user/toPage.do?page=login';
			}else{
//					alert('退出失败！');
				window.location.href = '${path}/user/toPage.do?page=login';
			}
		},
		error: function (data, textStatus, errorThrown) {
			var s=JSON.stringify(data);
			//console.log(s);
		}
	});	
}

function changePwd(){
	layer.open({
		type: 2,
		area: [500+'px', 300 +'px'],
		fix: false, //不固定
		maxmin: true,
		shade:0.4,
		title: '修改密码',
		content: '${path}/user/toPage.do?page=user-password-edit',
		success: function(layero, index){
	    }
	});
}


</script> 
</body>
</html>
